<?php

namespace app\order\controller;
use app\common\controller\DBase;
use app\common\service\TiktokPackageApiService;
use app\order\logic\OrderLogic;
use app\order\logic\OrderShipLogic;
use app\order\logic\OrderServiceLogic;
use app\order\logic\OrderWebHookLogic;
use app\shop\logic\ShopLogic;
use app\customer\logic\BatchMessageLogic;
use app\common\service\JinyiApiService;

class OrderList extends DBase
{



    /**
     * @desc  定时更新店铺的token
     * @date  2024/4/09
     * @author luckyXiong
     */
    public function updateShopToken(){
        $params = $this->request->get();
        return (new ShopLogic())->updateShopToken();
    }

    /**
     * @desc  定时更新金蚁的token
     * @date  2024/4/12
     * @author luckyXiong
     */
    public function updateJINYIToken(){
        $params = $this->request->get();
        return (new ShopLogic())->updateJINYIToken($params);
    }



    /**
     * @desc    手动触发填充客户名称
     * @date    2024/4/13
     * @author  luckyXiong
     */
    public function updateUserName(){
        $data   = $this->request->get();
        $res  = (new OrderServiceLogic())->updateUserName($data);
        return $this->jsonMessage(200,true,'操作成功');
    }



    /**
     * @desc     金蚁发货回传物流单号正常
     * @date     2024/4/13
     * @author   luckyXiong
     */
    public function upJinyiTrack(){
        $data   = $this->request->get();
        $res    = (new OrderServiceLogic())->updateJinYiTrackingNumber($data);
        return $this->jsonMessage(200,true,'操作成功',$res);
    }


    /**
     * @desc     金蚁发货回传物流单号网红
     * @date     2024/4/13
     * @author   luckyXiong
     */
    public function upJinyiTkWh(){
        $data   = $this->request->get();
        $res    = (new OrderServiceLogic())->updateJinYiTrackingWHNumber($data);
        return $this->jsonMessage(200,true,'操作成功',$res);
    }



    /**
     * @desc     金蚁发货回传物流单号
     * @date     2024/4/13
     * @author   luckyXiong
     */
    public function jinYiTrackingNumberToTik(){
        $data   = $this->request->get();
        return (new OrderServiceLogic())->updateJinYiTrackingNumber($data);
    }



    /**
     * @desc     定时去拉取订单列表数据
     * @atuthor  luckyXiong
     * @date     2024-04-08
     */
    public function orderList(){
        $data   = $this->request->get();
        return (new OrderServiceLogic())->syncOrderList($data);
    }


    /**
     * @desc     定时去拉取订单列表数据
     * @atuthor  luckyXiong
     * @date     2024-04-08
     */
    public function getOrderListConsumer(){
        $data   = $this->request->post();
        $res    = (new OrderLogic())->getOrderListConsumer($data);
        return $this->jsonMessage(200, '操作成功',$res);
    }



    /**
     * @desc     定时更新订单部分数据
     * @atuthor  luckyXiong
     * @date     2024-04-11
     */
    public function orderInfo(){
        $data   = $this->request->get();
        return (new OrderServiceLogic())->orderUpdate($data);
    }



    /**
     * @desc     定时去拉取订单列表数据MQ
     * @atuthor  luckyXiong
     * @date     2024-04-08
     */
    public function getOrderInfoConsumer(){
        $data   = $this->request->post();
        $res    =  (new OrderLogic())->getOrderInfoConsumer($data);
        return $this->jsonMessage(200, '操作成功',$res);
    }


    /**
     * @desc     金蚁物流单号更新MQ
     * @author   luckyXiong
     * @date     2024-04-13
     */
    public function updateJinyiTrackConsumer(){
        $data   = $this->request->post();
        $res    =  (new JinyiApiService())->tracking_number_update_consumer($data);
        return $this->jsonMessage(200, '操作成功',$res);
    }


    /**
     * @desc     拉取面单费用数据
     * @author   luckyXiong
     * @date     2024-04-25
     */
    public function syncShippingFees(){
        return (new OrderLogic())->syncShippingFees();
    }



    /**
     * @desc     拉取面单费用数据消费测试
     * @author   luckyXiong
     * @date     2024-04-26
     */
    public function shippingFeeConsumer(){
        $data   = $this->request->post();
        $res    = (new OrderLogic())->shipping_fee_consumer($data);
        return $this->jsonMessage(200, '操作成功',$res);
    }


    /**
     * @desc     拉取订单更新数据写入
     * @author   luckyXiong
     * @date     2024-04-27
     */
    public function operateOrderConsumer(){
        $data   = $this->request->post();
        $res    = (new OrderLogic())->operate_order_consumer($data);
        return $this->jsonMessage(200, '操作成功',$res);
    }



    /**
     * @desc     拉取订单更新数据写入
     * @author   luckyXiong
     * @date     2024-04-25
     */
    public function operateOrderProduce(){
        $res    = (new OrderLogic())->operateOrderProduce();
        return $this->jsonMessage(200, '操作成功',$res);
    }



    /**
     * @desc     access_token
     * @date     2024-05-05
     */
    public function getAccessToken(){
        $data   = $this->request->post();
        $res    = (new OrderLogic())->getAccessToken($data);
        return $this->jsonMessage(200, '操作成功',$res);
    }




    /**
     * @desc  消息群发队列
     * @date  2024-05-24
     * @author luckyXiong
     */
    public function batchSendMessageConsumer(){
        $data   = $this->request->post();
        $res    = (new BatchMessageLogic())->private_send_message_consumer($data);
        return $this->jsonMessage(200, '操作成功',$res);
    }




    /**
     * @desc  定时更新用户基本信息
     * @date  2024-05-06
     * @author luckyXiong
     */
    public function updateUserInfo(){
        $data   = $this->request->post();
        $res    = (new OrderLogic())->updateUserInfoProduce($data);
        return $this->jsonMessage(200, '操作成功',$res);
    }




    /**
     * @desc  定时更新运单号
     * @date  2024-05-07
     * @author luckyXiong
     */
    public function updateTrackingNumber(){
        $data   = $this->request->post();
        $res    = (new OrderLogic())->updateTrackingNumber($data);
        return $this->jsonMessage(200, '操作成功',$res);
    }



    /**
     * @desc     定时去拉取订单列表数据
     * @atuthor  luckyXiong
     * @date     2024-04-08
     */
    public function orderStatementList(){
        $data   = $this->request->get();
        return (new OrderServiceLogic())->orderStatementList($data);
    }

    /**
     * @desc     定时去拉取订单列表数据
     * @date     2024-04-08
     */
    public function orderStatementListReset(){
        $data   = $this->request->get();
        return (new OrderServiceLogic())->orderStatementListReset($data);
    }

    /**
     * @desc     定时去拉取订单列表数据
     * @atuthor  zh
     * @date     2024-05-24
     */
    public function orderStatementListtest(){
        $data   = $this->request->get();
        return (new OrderServiceLogic())->orderStatementListtest($data);
    }

    /**
     * @desc     定时去拉取订单列表数据
     * @atuthor  luckyXiong
     * @date     2024-04-08
     */
    public function orderRefundList(){
        $data   = $this->request->get();
        return (new OrderServiceLogic())->orderRefundList($data);
    }

    /**
     * @desc     TIK买面单生成PDF失败处理
     * @atuthor  luckyXiong
     * @date     2024-05-11
     */
    public function getTikPdfProduce(){
        $data   = $this->request->get();
        $res    = (new OrderServiceLogic())->getTikPdf($data);
        return $this->jsonMessage(200, '操作成功',$res);
    }


    /**
     * @desc     TIK买面单消费
     * @atuthor  luckyXiong
     * @date     2024-05-14
     */
    public function getTikPdfConsumer(){
        $data   = $this->request->post();
        $res    = (new TiktokPackageApiService())->downDocUrl($data);
        return $this->jsonMessage(200, '操作成功',$res);
    }

    /**
     * @desc     订单到每月月底就冻结order表数据
     * @atuthor  zh
     * @date     2024-05-24
     */
    public function orderFreezeList(){
        $data   = $this->request->get();
        return (new OrderServiceLogic())->orderFreezeList($data);
    }

    /**
     * @desc     更新店铺名称
     */
    public function updateShopName(){
        $params = $this->request->get();
        return (new ShopLogic())->updateShopName();
    }


    /**
     * @desc     获取订单信息补全用户
     * @atuthor  luckyXiong
     * @date     2024-06-15
     */
    public function getPhoneInfo(){
        $data   = $this->request->post();
        $res    = (new OrderLogic())->getPhoneInfo($data);
        return $this->jsonMessage(200, '操作成功',$res);
    }



    /**
     * @desc     获取订单信息补全用户
     * @atuthor  luckyXiong
     * @date     2024-06-18
     */
    public function getWebOrderInfo(){
        $data   = $this->request->get();
        $res    = (new OrderLogic())->getWebOrderInfo($data);
        return $this->jsonMessage(200, '操作成功',$res);
    }




    /**
     * @desc     定时去拉取同步没有面单的数据
     * @atuthor  luckyXiong
     * @date     2024-07-04
     */
    public function getDocumentpdf(){
        $data   = $this->request->get();
        $res    = (new OrderServiceLogic())->getDocumentpdf($data);
        return $this->jsonMessage(200, '操作成功',$res);
    }








}